package com.csh.szhm.utils.sharepreferences;

import java.io.IOException;

import com.csh.szhm.SzhmApplication;
import com.csh.szhm.utils.StringUtil;

import android.content.SharedPreferences;

/**
 * 缓存数据
 * 
 * @author dennis
 *
 */
public class SharedPreferencesUtil {

	private static SharedPreferences mSharedPreferences;

	private static SharedPreferencesUtil mSharedPreferencesUtil;

	private SharedPreferencesUtil() {
	}

	public static SharedPreferencesUtil getInstance() {
		if (mSharedPreferencesUtil == null) {
			mSharedPreferencesUtil = new SharedPreferencesUtil();
		}
		if (mSharedPreferences == null) {
			mSharedPreferences = new SecurePreferences(
					SzhmApplication.getInstance());
		}
		return mSharedPreferencesUtil;
	}

	public void setCityName(String city) {
		mSharedPreferences.edit().putString("city", city).commit();
	}

	public String getCityName() {
		return mSharedPreferences.getString("city", "");
	}

	public void setCityId(String cityid) {
		mSharedPreferences.edit().putString("city_id", cityid).commit();
	}

	public String getCityId() {
		return mSharedPreferences.getString("city_id", "");
	}
}
